package com.example.mymap;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.media.Image;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;

public class DescriptionActivity extends AppCompatActivity {
    private ImageButton btn_des_back;
    private TextView place_name, place_des;
    private ImageView place_pic;
    Intent mIntent;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_description);
        mIntent = getIntent();
        init();
    }

    private void init(){
        place_name = (TextView)findViewById(R.id.place_name);
        place_des = (TextView)findViewById(R.id.place_des);
        place_pic = (ImageView)findViewById(R.id.place_pic);
        //获取从MainActivity传输过来的数据
        Bundle bd = mIntent.getExtras();
        //地名
        int nameid = bd.getInt("name");
        place_name.setText(nameid);
        //描述
        int desid = bd.getInt("des");
        place_des.setText(desid);
        //图片
        int picid = bd.getInt("picname");
        place_pic.setImageResource(picid);

    }

    //绑定返回按钮的点击事件
    public void back_onclick(View v){
        Intent mIntent2 = new Intent();
        mIntent2.setClass(DescriptionActivity.this, MainActivity.class);
        startActivity(mIntent2);
    }
}